package practicalWork;

import java.util.ArrayList;
import java.util.List;

import exception.NoEsNotaValidaException;
import subjectAndProfessorship.EnrolledInProfessorship;
import util.MyDate;

/**
 * autor:Medici Maria Laura
 */
public class Individual extends ToHandIn {
	/* ******************************** Variables ******************************** */
	private EnrolledInProfessorship student;
	
	/* ******************************* Constructor ******************************* */
	public Individual(MyDate submiteDate,  EnrolledInProfessorship student) {
		super(submiteDate);
		this.student = student;
	}

	/* ******************************** Get & Set ******************************** */
	public void setStudent(EnrolledInProfessorship student) {
		this.student = student;
	}

	public EnrolledInProfessorship getStudent() {
		return student;
	}

	public String apellido() {
		return this.getStudent().apellidoAlumno();
	}
	
	/* ********************************* Metodos ********************************* */
	
	/**
	 * /se fija si una entrega es de un alumno
	 */
	public boolean perteneceAlumno(EnrolledInProfessorship alumno) {
		return this.getStudent().equals(alumno);
	}

	/**
	 * Toma al alumno que hizo la entrega como representante
	 */
	public EnrolledInProfessorship takeAlumnoRepresentante() {	
		return this.getStudent();
	}

	/**
	 * Arma una lista de alumnos con todos los alumnos de una entrega
	 */
	public List<EnrolledInProfessorship> makeListAlumno() {
		List<EnrolledInProfessorship> unAlum = new ArrayList<EnrolledInProfessorship>();
		unAlum.add(this.getStudent());
		return unAlum;
	}

	/**
	 * Agrega una nota a la lista de notas de un alumno
	 */
	public void agregarNotaAAlumno(int nota) {
	
			try {
				this.getStudent().agregarNota(nota);
			} catch (NoEsNotaValidaException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
		
	}

	/**
	 * Pregunta si la variable alumno esta vacia
	 */
	public boolean vacia() {
		return this.getStudent() == null;
	}
}
